package edu.dut.personal_scheduler.ui.fragment;

import edu.dut.personal_scheduler.ui.MainActivity;
import android.app.Activity;
import android.content.Context;
import android.support.v4.app.Fragment;
import android.view.inputmethod.InputMethodManager;

public abstract class AbsFragment extends Fragment {

	protected void startFragent(AbsFragment iFragment, boolean addBackStack) {
		Activity mActivity = getActivity();
		if (mActivity != null && mActivity instanceof MainActivity) {
			((MainActivity) mActivity).startFragment(iFragment, addBackStack);
		}
	}

	protected void hideOrShowInput() {
		InputMethodManager imm = (InputMethodManager) (getActivity().getSystemService(Context.INPUT_METHOD_SERVICE));
		imm.toggleSoftInput(0, InputMethodManager.HIDE_NOT_ALWAYS);
	}

	protected boolean getInputStatus() {
		return ((InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE)).isActive();
	}

	public abstract String getPageTitle();

}
